import Router from 'koa-router'
const router = new Router()

import UserController from '../../controllers/UserController.js'

/**
 * @swagger
 * /api/login:
 *   post:
 *     tags:
 *       - 用户
 *     summary: 用户登录
 *     description: 用户登录
 *     requestBody:
 *       content:
 *         application/json:
 *           schema:
 *             type: object
 *             required:
 *               - mobile
 *               - type
 *             properties:
 *               mobile:
 *                 type: string
 *                 description: 手机号
 *     responses:
 *       200:
 *         description: 成功响应
 *         content: 
 *           application/json:
 *            schema:
 *              type: object
 *              properties:
 *                errcode:
 *                  type: integer
 *                  description: 0成功 非0失败
 *                errmsg:
 *                  type: string
 *                  description: 描述
 *                data:
 *                  type: object
 *                  description: 信息返回
 *                  required:
 *                    - access_token
 *                    - refresh_token
 *                  properties:
 *                    access_token:
 *                      type: string
 *                      description: 登录凭证
 *                    refresh_token:
 *                      type: string
 *                      description: 刷新Token
 */
router.post('/login', (new UserController).login)

router.get('/user/list', (new UserController).list)

export default router